import React, { useState, useEffect } from 'react'
import { Input } from 'antd';
import { request } from 'umi';
import useObserver from '@/hooks/observe';
export default function index() {
  let [list, setList] = useState([])
  const getList = () => {
    request("/api/list").then(res => {
      console.log(res)
      setList(res)
    })
  }
  useObserver("box", (e:any) => {
    console.log(e)
  })
  useEffect(() => {
    getList()
  }, [])
  return (
    <div>
      <Input style={{
        textAlign: "center"
      }}
        placeholder='请输入内容'
      />
      {list.length && list.map((ele: any) => (
        <div key={ele.id} style={{
          width: "90%",
          display: "flex",
          justifyContent: "space-around",
          margin: "20px auto"
        }}>
          <img src={ele.src} style={{
            width: "60%"
          }} />
          <div>
            <p>{ele.addrs}</p>
            <p style={{
              color: 'red'
            }}>{ele.money}</p>
          </div>
        </div>
      ))}

      <h1 id='box'>loda...</h1>
    </div>
  )
}
